package cn.buk.flight.entity;

import java.util.Date;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;

@Entity
@Table(name="nfd_result")
public class NfdResult {
	public static StringBuffer exportHeaderToStringBuffer() {
		StringBuffer sb = new StringBuffer();

		sb = sb.append("航空公司");
		sb = sb.append(",");
		sb = sb.append("出发机场");
		sb = sb.append(",");
		sb = sb.append("到达机场");
		sb = sb.append(",");

		sb = sb.append("销售舱位");
		sb = sb.append(",");
		sb = sb.append("运价基础");
		sb = sb.append(",");

		sb = sb.append("单程价格");
		sb = sb.append(",");
		sb = sb.append("往返价格");
		sb = sb.append(",");

		sb = sb.append("生效日期");
		sb = sb.append(",");
		sb = sb.append("失效日期");
		sb = sb.append(",");
		sb = sb.append("ap");
		sb = sb.append(",");

		sb = sb.append("\r");

		return sb;
	}

	public StringBuffer exportContentToStringBuffer() {
		StringBuffer sb = new StringBuffer();

		sb = sb.append(this.carrier);
		sb = sb.append(",");
		sb = sb.append(this.dport);
		sb = sb.append(",");
		sb = sb.append(this.aport);
		sb = sb.append(",");
		sb = sb.append(this.subclass);
		sb = sb.append(",");
		sb = sb.append(this.fareclass);
		sb = sb.append(",");

		if (this.owPrice == 0) {
      sb = sb.append("");
    } else {
      sb = sb.append(this.owPrice);
    }
		sb = sb.append(",");
		if (this.rtPrice == 0) {
      sb = sb.append("");
    } else {
      sb = sb.append(this.rtPrice);
    }
		sb = sb.append(",");

		sb = sb.append(this.effectDate);
		sb = sb.append(",");

		if (this.expireDate == null) {
      sb = sb.append("");
    } else {
      sb = sb.append(this.expireDate);
    }
		sb = sb.append(",");

		sb = sb.append(this.ap);
		sb = sb.append(",");

		sb = sb.append("\r");

		return sb;
	}


	@Id
	@GeneratedValue(strategy= GenerationType.IDENTITY)
	private int id;

	@Column(name = "enterprise_id")
	private int enterpriseId;
	
	@Column(length=2)
	private String carrier;
	
	@Column(length=3, name="dport")
	private String dport;

	@Column(length=3, name="aport")
	private String aport;
	
	@Column(length=2, name = "RBD")
	private String subclass;
	
	@Column(length=10, name = "FareBaseCode")
	private String fareclass;

	@Column(name="FareOW", precision=6)
	private int owPrice;
	
	@Column(name="FareRt", precision=6)
	private int rtPrice;
	
	@Temporal(TemporalType.DATE)
	@Column(name="dateEffect")
	private Date effectDate;
	
	@Temporal(TemporalType.DATE)
	@Column(name="dateExpire")
	private Date expireDate;

	/**
	 * 提前预定天数
	 */
	private int ap;

    @Temporal(TemporalType.TIMESTAMP)
	private Date lastupdate;

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return the carrier
	 */
	public String getCarrier() {
		return carrier;
	}

	/**
	 * @param carrier the carrier to set
	 */
	public void setCarrier(String carrier) {
		this.carrier = carrier;
	}

	/**
	 * @return the depPort
	 */
	public String getDport() {
		return dport;
	}

	/**
	 * @param depPort the depPort to set
	 */
	public void setDport(String depPort) {
		this.dport = depPort;
	}

	/**
	 * @return the arrPort
	 */
	public String getAport() {
		return aport;
	}

	/**
	 * @param arrPort the arrPort to set
	 */
	public void setAport(String arrPort) {
		this.aport = arrPort;
	}

	/**
	 * @return the subclass
	 */
	public String getSubclass() {
		return subclass;
	}

	/**
	 * @param subclass the subclass to set
	 */
	public void setSubclass(String subclass) {
		if (subclass != null) {
      subclass = subclass.trim();
    }
		this.subclass = subclass;
	}

	/**
	 * @return the fareclass
	 */
	public String getFareclass() {
		return fareclass;
	}

	/**
	 * @param fareclass the fareclass to set
	 */
	public void setFareclass(String fareclass) {
		this.fareclass = fareclass;
	}

	/**
	 * @return the owPrice
	 */
	public int getOwPrice() {
		return owPrice;
	}

	/**
	 * @param owPrice the owPrice to set
	 */
	public void setOwPrice(int owPrice) {
		this.owPrice = owPrice;
	}

	/**
	 * @return the effectDate
	 */
	public Date getEffectDate() {
		return effectDate;
	}

	/**
	 * @param effectDate the effectDate to set
	 */
	public void setEffectDate(Date effectDate) {
		this.effectDate = effectDate;
	}

	/**
	 * @return the expireDate
	 */
	public Date getExpireDate() {
		return expireDate;
	}

	/**
	 * @param expireDate the expireDate to set
	 */
	public void setExpireDate(Date expireDate) {
		this.expireDate = expireDate;
	}

	/**
	 * @return the lastupdate
	 */
	public Date getLastupdate() {
		return lastupdate;
	}

	/**
	 * @param lastupdate the lastupdate to set
	 */
	public void setLastupdate(Date lastupdate) {
		this.lastupdate = lastupdate;
	}

	/**
	 * @return the rtPrice
	 */
	public int getRtPrice() {
		return rtPrice;
	}

	/**
	 * @param rtPrice the rtPrice to set
	 */
	public void setRtPrice(int rtPrice) {
		this.rtPrice = rtPrice;
	}

	public int getAp() {
		return ap;
	}

	public void setAp(int ap) {
		this.ap = ap;
	}

	public int getEnterpriseId() {
		return enterpriseId;
	}

	public void setEnterpriseId(int enterpriseId) {
		this.enterpriseId = enterpriseId;
	}
}